package com.Sing.Controller;

import com.Sing.Dao.BookMapper;
import com.Sing.Pojo.Book;
import com.Sing.Service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;

@Controller
public class StatisticController {

    private BookService bookService;
    @Autowired
    @Qualifier("bookServiceImpl")
    public void setBookService(BookService bookService) {
        this.bookService = bookService;
    }

    // 展示分析视图
    @RequestMapping("/statisticIndex")
    public String statisticIndex( Model model ){

        ArrayList<Book> list = bookService.getCountByType();
        model.addAttribute( "list", list );

        return "count/statisticIndex";
    }

}
